﻿@model IEnumerable<DCH.Models.Register>

@{
    ViewBag.Title = "Registered Members";
}
<h2>Search</h2>
@{ using (Html.BeginForm(FormMethod.Post))
{
    @Html.TextBox("searchStr")
    <p>Search by player name, clubname,  captain name, state, city, ID, phonenumber, player skill & email</p>
    <input type="hidden" name="type" value="team" />
    <input type="submit" class="Search"  value="Search"/>
}
}    
   @Html.ActionLink("Clear search" , "Index")  


<h2>Registered Teams <a style="color: #fff ;" class="smallBtn" href="@Url.Action("ExportData", "Register", new { area = "admin" })">Export</a></h2>
   


<table class="table">
    <tr>
        <th>No.
        </th>
        <th>Member ID
        </th>
        <th>Club Name
        </th>
        <th>Captain Name
        </th>


        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Phone)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.City)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.State)
        </th>
        <th>Transaction / Reference / Cheque no.
        </th>
        <th>Payment Type</th>
        <th>
            @Html.DisplayNameFor(model => model.Payment)
        </th>
        <th></th>
    </tr>
    @{ int i = 0;
       foreach (var item in Model)
       {
    
        <tr>
            <td>
                <text>  @(++i)  </text>

            </td>

            <td>
                @{var ID = string.Empty;
                  var MemberID = string.Empty;
                  switch (item.ID.ToString().Length)
                  {
                      case 1:
                          ID = "00" + item.ID.ToString();
                          break;
                      case 2:
                          ID = "0" + item.ID.ToString();
                          break;
                      default:
                          ID = item.ID.ToString();
                          break;
                  }

                  if (item.State.Substring(0, 3).ToLower().Contains("pun"))
                  {
                      MemberID = "PBT" + ID;
                  }
                  else
                  {
                      MemberID = "HRT" + ID;
                  }
                }
                @MemberID
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ClubName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CaptainName)
            </td>


            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Phone)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.City)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.State)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.TransactionNumber)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PaymentType)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Payment)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
            @Html.ActionLink("Details", "Details", new { id = item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.ID })
            </td>
        </tr>
       }
    }
</table>

<h2>Registered Players <a style="color: #fff ;" class="smallBtn"  href="@Url.Action("ExportPlayers", "Register", new { area = "admin" })">Export</a></h2>
@*@{ using (Html.BeginForm(FormMethod.Post))
{
    @Html.TextBox("searchStr")
    <input type="hidden" name="type" value="player" />
    <input type="submit" class="Search" />
}
}  @Html.ActionLink("Clear search" , "Index")*@     
<table class="table">
    <tr>
        <th>No.

        </th>
        <th>Member ID
        </th>
        <th>Player Name
        </th>
        <th>Player Skill
        </th>

        <th>
            @Html.DisplayNameFor(model => model.Email)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Phone)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.City)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.State)
        </th>
        <th>Transaction / Reference / Cheque no.
        </th>
        <th>Payment Type</th>
        <th>
            @Html.DisplayNameFor(model => model.Payment)
        </th>
        <th></th>
    </tr>
    @{
        int j = 0;
        foreach (DCH.Models.Register item in ViewBag.Player)
        {
        <tr>
            <td>
                <text>  @(++j)  </text>

            </td>
            <td>
                @{var ID = string.Empty;
                  var MemberID = string.Empty;
                  switch (item.ID.ToString().Length)
                  {
                      case 1:
                          ID = "00" + item.ID.ToString();
                          break;
                      case 2:
                          ID = "0" + item.ID.ToString();
                          break;
                      default:
                          ID = item.ID.ToString();
                          break;
                  }

                  if (item.State.Substring(0, 3).ToLower().Contains("pun"))
                  {
                      MemberID = "PBI" + ID;
                  }
                  else
                  {
                      MemberID = "HRI" + ID;
                  }
                }
                @MemberID
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PlayerName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PlayerSkill)
            </td>

            <td>
                @Html.DisplayFor(modelItem => item.Email)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Phone)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.City)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.State)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.TransactionNumber)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.PaymentType)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Payment)
            </td>

            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
            @Html.ActionLink("Details", "Details", new { id = item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.ID })
            </td>
        </tr>
        }
    }
</table>
